package cn.lijiajia3515.cairo.example1.controller;

import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.PermitAll;
import java.net.InetAddress;
import java.net.UnknownHostException;

@RestController
@RequestMapping
public class IndexController {

	private final ServerProperties server;

	public IndexController(ServerProperties properties) {
		this.server = properties;
	}

	@RequestMapping
	public String index() throws UnknownHostException {
		return String.format("%s:%s", InetAddress.getLocalHost(), server.getPort());
	}
}
